#include "GroupAdapterOldVersion.h"

namespace jm4bbx {

#ifdef BOBOX_VERSION_OLD

	GroupAdapterOldVersion::GroupAdapterOldVersion(groupImpl* g, boxImpl* box, groupType gType) 
		: group_(g)
		, box_(box)
		, groupType_(gType) { }

	size_t GroupAdapterOldVersion::getReadBegin() const {
		return group_->rdbegin_;
	}

	size_t GroupAdapterOldVersion::getReadPosition() const {
		return group_->rdpos_;
	}

	size_t GroupAdapterOldVersion::getReadEnd() const {
		return group_->rdend_;
	}

	void GroupAdapterOldVersion::moveReadPosition(int val /*= 1*/) {
		group_->rdpos_ += val;
	}

	void GroupAdapterOldVersion::relocate(size_t from, size_t to) {
		group_->wrbegin_ = from;
		resize(to);
	}

	void GroupAdapterOldVersion::allocate(size_t size) {
		const_cast<RootBox*>(box_)->allocate(groupType_, size);
		resize(size);
	}


	void GroupAdapterOldVersion::resize(size_t size) {
		group_->wrpos_ = size;
		group_->wrend_ = size;
	}

	bool GroupAdapterOldVersion::isPoisoned() const {
		return group_->poisoned_;
	}

	size_t GroupAdapterOldVersion::getColumnCount() const {
		return group_->columns_.size();
	}

#endif

} // namespace jm4bbx

